﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InsuranceCompany.Core.Domain.Objects
{
    public class Event : Entity
    {
        public DateTime EventDate { get; set; }
        public string Description { get; set; }

        public Event()
        {
            this.EventDate = DateTime.Today.Date;
            this.Description = "New event";
        }
        public Event(DateTime dt)
        {
            this.EventDate = dt;
            this.Description = "New event";
        }
        public Event(int hours, int minutes, int seconds)
        {
            this.EventDate = new DateTime(hours, minutes, seconds);
            this.Description = "New event";
        }
        public Event(string description)
        {
            this.EventDate = DateTime.Today.Date;
            this.Description = description;
        }
        public Event(int hours, int minutes, int seconds, string description)
        {
            this.EventDate = new DateTime(hours, minutes, seconds);
            this.Description = description;
        }
        public Event(DateTime dt, string description)
        {
            this.EventDate = dt;
            this.Description = description;
        }
        public Event(Event ev) :base(ev)
        {
            this.EventDate = ev.EventDate;
            this.Description = ev.Description;
        }

        public static int compareEvents (Event evX, Event evY)
        {
            DateTime x = evX.EventDate, y = evY.EventDate;
            if (x == null)
            {
                if (y == null)
                {
                    // If x is null and y is null, they're equal. 
                    return 0;
                }
                else
                {
                    // If x is null and y is not null, y is greater. 
                    return -1;
                }
            }
            else
            {
                // If x is not null...
                if (y == null)
                // ...and y is null, x is greater.
                {
                    return 1;
                }
                else
                    return x.CompareTo(y);
            }
        }
    }
}
